package com.kuang;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;


@SpringBootApplication
@EnableEurekaClient//注册到服务中
@EnableDiscoveryClient//服务发现
@EnableCircuitBreaker
public class UserApplication_Hystrix_8001 {
/**
 * @description：TODO

 * @author     ：LK
 * @date       ：Created in 2021-10-26 15:20
 */
public static void main(String[] args) {
    SpringApplication.run(UserApplication_Hystrix_8001.class,args);
}
    // 增加一个Servlet到Hystrix Dashboard
    @Bean
    public ServletRegistrationBean hystrixMetricsStreamServlet(){
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registrationBean.addUrlMappings("/actuator/hystrix.stream");
        return registrationBean;
    }
}
